#ifndef _MISC_H
#define _MISC_H

// Users should include `judge.h', not this file.

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

// Type definition goes here.
typedef int32_t jstatus_t;
typedef int32_t judge_flag_t;

// Macros that help dealing with type `jstatus_t'.
#define JSUCCESS(x) ((x) >= 0)

// Add jstatus definitions here.
// Use non-negative value to indicate success, and negative value to indicate
// failure.
// All definitions starts with prefix `JSTATUS_'
#define JSTATUS_SUCCESS (0)
#define JSTATUS_BAD_ALLOC (-1)
#define JSTATUS_CONCURRENCY_LIMIT_EXCEEDED (-2)
#define JSTATUS_STILL_RUNNING (-3)
#define JSTATUS_ZIP_ERROR (-4)
#define JSTATUS_BAD_CONFIG (-5)
#define JSTATUS_OUT_OF_BOUND (-6)
#define JSTATUS_FILE_NOT_FOUND (-7)

// Judge flags definitions goes here.
#define JUDGE_ACCEPTED (0)
#define JUDGE_SYSTEM_ERROR (1)
#define JUDGE_COMPILE_ERROR (2)
#define JUDGE_RUNTIME_ERROR (3)
#define JUDGE_TIME_LIMIT_EXCEEDED (4)
#define JUDGE_MEMORY_LIMIT_EXCEEDED (5)
#define JUDGE_SOURCE_LIMIT_EXCEEDED (6)

#ifdef __cplusplus
}
#endif

#endif
